home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C ++ / Applications / TimGA 1.2.1 / .h / CGraphGADoc.h < prev    next >
Encoding:
Text File  |  1997-07-16  |  2.3 KB  |  78 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    CGraphGADoc.h        ©1995-97 Timo Eloranta        All rights reserved.
  3. // ===========================================================================
  4. //    The application class - subclassed from LDocument.
  5.  
  6. #pragma once
  7.  
  8. #include <LDocument.h>
  9. #include <LPeriodical.h>
  10.  
  11. #include "MyStructs.h"
  12. #include "CPopulation.h"
  13.  
  14. typedef vector<SNodePair, allocator<SNodePair> >    SNodePairVector;
  15.  
  16. Boolean    GridSizeOK( Int16 inGridSize, Int16 inNodes);
  17.  
  18. class    CGraphPane;
  19. class    CGraphWindow;
  20. class    CMyFileStream;
  21.  
  22. class    CGraphGADoc :     public LDocument,
  23.                         public LPeriodical {
  24. private:
  25.     CMyFileStream        *mMyFile;            // Replaces the LFile...
  26.                                             // ... and used instead of mFile
  27.     
  28.     CGraphWindow        *mWindow;            // Pointer to the window...                                        
  29.     CGraphPane            *mGraphPane;        // Pointer to the graph pane...
  30.  
  31.     SGraphSize            mGraphSize;            // Holds info on the nbr of
  32.                                             // nodes and edges in the graph
  33.                                             
  34.     SNodePairVector        mEdgeArray;            // An array of the edges
  35.                                             // ( edge = 2 node nbrs... )
  36.                                             
  37. //    Boolean                mRandomGraph;        // Is this a random graph?
  38.  
  39.     CPopulation            mPopulation;        // A population of graph drawings
  40.                                             // owned by this document.
  41.  
  42.     EIterState            mIterState;
  43.     Int16                mMaxSpendTime;        // Max number of ticks that the
  44.                                             // SpendTime function may spend
  45.                                             // on one calling...
  46.  
  47.  
  48.     void                PrepareToIterate( Boolean inDrawGraphNow );
  49.     void                SetIterState( EIterState inIterState);
  50.     
  51. public:
  52.                         CGraphGADoc( LCommander *inSuper, FSSpec *inFileSpec);
  53.                         ~CGraphGADoc() {};
  54.                     
  55.     virtual Boolean        ObeyCommand(CommandT inCommand, void *ioParam);
  56.     virtual void        FindCommandStatus(CommandT inCommand,
  57.                                 Boolean &outEnabled, Boolean &outUsesMark,
  58.                                 Char16 &outMark, Str255 outName);
  59.  
  60.     void                SpendTime( const EventRecord &inMacEvent);
  61.     
  62.     virtual void        DoPrint() {};
  63.     virtual StringPtr    GetDescriptor(Str255 outDescriptor) const;
  64.     
  65.     void                SetPopProbabilities( Int16    inCrossoverProb,
  66.                                              Int16    inMutationProb ) {
  67.                                     mPopulation.SetProbabilities(
  68.                                                      inCrossoverProb,
  69.                                                      inMutationProb ); };
  70.                                              
  71.     void                SetPopTermination( STermination    &inTermination ) {
  72.                             mPopulation.SetTermination( inTermination ); };
  73.         
  74. protected:
  75.     void                NameNewDoc();
  76.     Boolean                OpenFile( FSSpec &inFileSpec);
  77. };
  78.